FCLOSE

Section: Standard I/O Functions (3S)
Updated: August 1, 1992
Index Return to Main Contents
 

NAME

fclose, fflush - close or flush a stream  

SYNOPSIS

#include <stdio.h>

int fclose(FILE *stream); int fflush(FILE *stream);  

DESCRIPTION

Fclose causes any buffers for the named stream to be flushed, and the file to be closed. Buffers allocated by the standard input/output system are freed.

Fclose is performed automatically upon calling exit(3).

Fflush causes any buffered data for the named output or update stream to be written to that file. The stream remains open.

If stream is a null pointer, the fflush function performs this flushing action on all output and update streams.  

RETURN VALUE

Fclose and fflush return EOF for unsuccessful calls and store an error code in errno, otherwise returning zero.  

ERRORS

The underlying functions of fclose are write(2) and close(2). The underlying functions of fflush are write(2) and lseek(2). The error conditions specified for these functions apply to fclose and fflush.  

SEE ALSO

write(2), close(2), lseek(2), fopen(3S), setbuf(3S)


 

Index

NAME
SYNOPSIS
DESCRIPTION
RETURN VALUE
ERRORS
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 17:21:22 GMT, March 25, 2025